<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">

        function fn(a){
            this.a = a
        }
        var obj={}
        var getNum = fn.bind(obj);
        getNum(2);
        console.log(obj.a);//2



        //fn = fn (n-1) + fn (n-2)
        // 使用递归求到20的斐波那契数列之和
            var sum=1;
            var a=0;
            var b=1;
            var num=0;
        function fn(c){
            num++;
            c=a+b;
            sum+=c;
            if(num==20){
                return sum;
            }
            a=b;
            b=c;
            return fn(c)
        }
        console.log(fn());


    </script>
</body>
</html>